if __name__ == '__main__':
    import pandas as pd

    df = pd.read_excel("D:\\家宽\\2025-03\\2月广义累计（剔重后）.xlsx", usecols=['投诉时间', '账号'])
    df2 = pd.read_excel("D:\\家宽\\2025-03\\【2月累计】智慧装维.xlsx", usecols=['建单时间', '宽带账号', '工单号'])
    df.rename(columns={
        '账号': '宽带账号'
    }, inplace=True)
    df = df.merge(df2, on='宽带账号')

    df['投诉时间'] = pd.to_datetime(df['投诉时间'])
    df['建单时间'] = pd.to_datetime(df['建单时间'])

    # 筛选出半个小时内的数据
    filtered_df = df[(df['建单时间'] > df['投诉时间']) & (df['建单时间'] <= df['投诉时间'] + pd.Timedelta(minutes=30))]

    filtered_df.to_excel('/temp/t.xlsx')
